package com.yanqu.timer;

import com.yanqu.manager.DictMgr;
import com.yanqu.manager.UserGetGoodsMonitorMgr;
import com.yanqu.road.utils.ConfigHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import com.yanqu.road.utils.string.StringUtils;

import java.util.Calendar;

public class RemoveUserDataTask extends GeneralTask {

    @Override
    public void doRun() {

        try {

            new UserGetGoodsMonitorMgr().removeData();

        }catch (Exception e){
            getLOGGER().error("", e);
        }

        try{
            String serverType = ConfigHelper.getValue("serverType");
            if(!StringUtils.isNullOrEmpty(serverType)){
                Calendar rightNow = Calendar.getInstance();
                int hour  = rightNow.get(Calendar.HOUR_OF_DAY);
                if(hour == 1){
                    int minute = rightNow.get(Calendar.MINUTE);
                    if(minute == 1){
                        new DictMgr().reload();
                        getLOGGER().info("重载道具监控字典");
                    }
                }
            }
        }catch (Exception e){
            getLOGGER().error("", e);
        }
    }
}
